package com.nowcoder.Offer.Dp;

import org.junit.Test;

/**
 * 青蛙跳台阶
 */
public class JumpFloor {

    public int RectCover(int target) {
        if(target == 0) return 0;
        if(target == 1) return 1;
        int dp_i_2 = 0;
        int dp_i_1 = 1;
        int dp_i = 0;
        for(int i = 2; i<=target; i++){
            dp_i = dp_i_1 + dp_i_2;
            dp_i_2 = dp_i_1;
            dp_i_1 = dp_i;
        }
        return dp_i;
    }

    public int JumpFloorII(int target) {
        return (int)Math.pow(2,target-1);
    }

    @Test
    public void test(){
        for(int i = 0; i<8; i++){
            System.out.println(RectCover(i));
        }
    }
}
